package gui.menubar;

import gui.MainWindow;
import gui.Scaling;

import java.awt.*;
import java.awt.event.*;
import java.io.File;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;

import model.MetroModel;
import model.readers.ReadersRegistry;
import model.savers.MetroSaversRegistry;

/**
 * 
 * @author Ilya Shurigyn
 *
 */
public class EditorMenuBar extends JMenuBar {
	public EditorMenuBar(MainWindow parent){
		add(new FileMenu(parent));
		add(new EditMenu());

		javax.swing.FocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {

			@Override
			public boolean dispatchKeyEvent(KeyEvent arg0) {
				if(arg0.getID()==arg0.KEY_RELEASED) {
					if(arg0.isControlDown() && arg0.getKeyCode()==arg0.VK_Z) {
						MetroModel.getInstance().undo();
						return true;
					}

					if(arg0.isControlDown() && arg0.getKeyCode()==arg0.VK_Y) {
						MetroModel.getInstance().redo();
						return true;
					}
				}
				return false;
			}

		});
	}


}




